import {AxiosPromise} from "axios";
import {Result} from "@/model";
import {CardForm} from "@/api/card/types";
import request from "@/utils/request";


/**
 * 新增优惠卡片
 */
export function insertCard(data: CardForm): AxiosPromise<Result<null>> {
    return request({
        url: "/dome/card/add",
        method: "post",
        data,
    });
}

/**
 * 查询用户优惠卡片列表
 */
export function getCardList(): AxiosPromise<Result<CardForm[]>> {
    return request({
        url: "/dome/card/list",
        method: "get",
    });
}

/**
 * 更新优惠卡片价格
 */
export function updateCard(data: CardForm): AxiosPromise<Result<null>> {
    return request({
        url: "/dome/card/update",
        method: "post",
        data,
    });
}